<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script>
			function login(){
				var $uname=uname.value;
				var $upwd=upwd.value;
				if(!$uname){
					alert("用户名不能为空");
					return;
				}
				if(!$upwd){
					alert("密码不能为空");
					return;
				}
				var xhr=new XMLHttpRequest();
				xhr.open("GET",`/user/v1/login/${$uname}&${$upwd}`,true);
				xhr.send();
				xhr.onreadystatechange=function(){
					if(xhr.readyState==4 && xhr.status==200){
						var r=xhr.responseText;
						if(r==1){
						 d1.innerHTML="登录成功"
							
						}else{
							d1.innerHTML="登陆失败"
					}
				}
			}
			}
		</script>
	</head>
	<body>
		<input type="text" id="uname" />网名<br>
		<input type="text" id="upwd" />密码<br>
		<button onclick="login()">登录</button>
		<div id="d1"></div>
	</body>
</html>
